package developer.算法.链表.反转链表;

/**
 * @author zhangyongkang
 * @time 2024/6/12 10:55
 * @description
 *  [next] [next] [next] [next]
 */
public class Solution_other {
    // 链接：https://leetcode.cn/problems/reverse-linked-list/solutions/551596/fan-zhuan-lian-biao-by-leetcode-solution-d1k2/

    class Solution {
        public Solution_self.ListNode reverseList(Solution_self.ListNode head) {
            if (head == null || head.next == null) {
                return head;
            }
            Solution_self.ListNode newHead = reverseList(head.next);
            head.next.next = head;
            head.next = null;
            return newHead;
        }
    }

}
